|
|
|
A class is an actual
representation of an ADT. It therefore provides implementation details
for the data structure used and operations.
|
|
In the example above as
well as in examples which follow we use a notation which is not programming
language specific. In this notation class {...} denotes the definition
of a class. Enclosed in the curly brackets are two sections attributes: and
methods: which define the implementation of the data structure and operations
of the corresponding ADT. Again we distinguish the two levels with different
terms: At the implementation level we speak of “attributes'' which are
elements of the data structure at the ADT level. The same applies to “methods''
which are the implementation of the ADT operations.
|
|
We only define two methods setValue()
and addValue() representing the two operations set and add.
|